﻿@model QzgfFrame.System.MenuManger.Models.SystemMenu
@*
model Tuple< QzgfFrame.System.MenuManger.Models.SystemMenu, QzgfFrame.System.RoleManger.Models.SystemRole>
@Html.TextBoxFor(m=>m.Item1.Pic)
@Html.TextBoxFor(m=>m.Item2.Rolename)
*@
          
@{
    ViewBag.Title = "Register";
}

 
@using (Html.BeginForm("edit", "Menu", FormMethod.Post, new { name = "form1", id = "form1" }))
{
     @Html.HiddenFor(m => m.Id)
    @Html.ValidationSummary(true, "Account creation was unsuccessful. Please correct the errors and try again.")
       <div>
        <table cellpadding="0" border="0" cellspacing="0" class="edittable">
            <tbody>
                <tr>
                    <td align="right" class="editcellmessage">菜单名</td>
                    <td align="right" class="editcellverify"><div class="l-verify-star">*</div></td>
                    <td align="left" class="editcell">
                    @Html.TextBoxFor(m => m.Name, new { validate = "{required:true,minlength:1}", ltype = "text" })
                </tr>
                <tr>
                    <td align="right" class="editcellmessage">图标：</td>
                    <td align="right" class="editcellverify"><div class="l-verify-star"></div></td>
                    <td align="left" class="editcell">
                    @Html.TextBoxFor(m => m.Pic, new { ltype = "text" })
                    </td> 
                </tr> 
                <tr>
                    <td align="right" class="editcellmessage">链接地址：</td>
                    <td align="right" class="editcellverify"><div class="l-verify-star"></div></td>
                    <td align="left" class="editcell">
                    @Html.TextBoxFor(m => m.Url, new { ltype = "text" })
                    </td> 
                </tr>
                 <tr>
                    <td align="right" class="editcellmessage">权限标识：</td>
                    <td align="right" class="editcellverify"><div class="l-verify-star"></div></td>
                    <td align="left" class="editcell">
                    @Html.TextBoxFor(m => m.Permissionsflag, new { ltype = "text" })
                    </td> 
                </tr>
                <tr>
                    <td align="right" class="editcellmessage">排序：</td>
                    <td align="right" class="editcellverify"><div class="l-verify-star">*</div></td>
                    <td align="left" class="editcell">
                     @Html.TextBoxFor(m => m.Orderno, new { ltype = "text" })
                    </td> 
                </tr>
                <tr>
                    <td align="right" class="editcellmessage">父结点：</td>
                    <td align="right" class="editcellverify"><div class="l-verify-star">*</div></td>
                    <td align="left" class="editcell">
                     @Html.TextBoxFor(m => m.FatherName, new { validate = "{required:true,minlength:1}", ltype = "text" })
                     @Html.HiddenFor(m => m.Father)
                     @*
                     <input type="text" id="Father"/>
                     Html.DropDownList("Father", (SelectList)ViewData["DropFatherData"])
                     *@
                    </td>
                </tr>
                <!--  -->
                    <tr>
                    <td align="right" class="editcellmessage">是否菜单：</td>
                    <td align="right" class="editcellverify"><div class="l-verify-star">*</div></td>
                    <td align="left" class="editcell">
                     @Html.DropDownList("Ismenu", new List<SelectListItem>{
                                            (new SelectListItem() {Text = "否", Value = "0", Selected = false}),
                                            (new SelectListItem() {Text = "是", Value = "1", Selected = true})
                                        })
                    </td>
                </tr>     
               

                <tr>
                <td>

                </td>
                </tr>
            </tbody>
        </table>
    </div> 
}
    <script src="@Url.Content("~/Lib/jquery-validation/jquery.validate.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Lib/jquery-validation/messages_cn.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Lib/jquery-validation/jquery.metadata.js")" type="text/javascript"></script>
    <script type="text/javascript">
        //var CurID =  <%=CurID %>;
        //validate = "{digits:true}",
        var Validator = null;
        $(function () {
            //处理下拉框
            $("#FatherName").ligerComboBox({
                selectBoxWidth: 200, treeLeafOnly: false,
                selectBoxHeight: 150, valueFieldID: 'Father', textFieldID: 'FatherName',
                tree: { url: '/system/menu/GetMenu', checkbox: false, topParentIDValue: -1, idFieldName: 'id', parentIDFieldName: 'pid' }
            });
            $("#Ismenu").ligerComboBox({ selectBoxHeight: 50 }); //{height:10} selectBoxWidth: 200,
            //验证
            $.metadata.setType("attr", "validate");
            $("#form1").ligerForm();
            deafultValidate($("#form1"));
            Validator = $("#form1").validate();
            debugger;
        });

        function f_success() {
            $(document).ready(function () {
                $.ligerDialog.confirm("是否继续编辑", "保存成功", function (ok) {
                    $.ligerDialog.closeWaitting();
                    parent.window.frames["mainframe"].f_reload();
                    if (!ok) {
                        parent.window.frames["mainframe"].f_closeWindow();
                    }
                });
            });
        }
        function f_error(message) {
            $(document).ready(function () {
                $.ligerDialog.error(message);
            });
        }
        function f_save() {
            debugger;
            if(!Validator.form()) return;
            $.ligerDialog.waitting("正在保存中...");
            //提交数据
            document.forms[0].submit();
        } 
    </script>
     <style type="text/css">
        .edittable .editcellmessage,.edittable .editcellverify,.edittable .editcell{ padding:4px;line-height:23px;}
        .edittable .editcellmessage{ padding-left:20px;} 
        body { font-size:12px; background:white;}
        /*出现边框效果
        fieldset {
            padding:10px;
            margin:10px;
            color:#333; 
            border:#06c dashed 1px;
        } 
        legend {
            color:#06c;
            font-weight:800; 
            background:#fff;
        }*/

    </style>
